<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <#assign base=request.contextPath  />
    <link rel="stylesheet" href="${base}/js/layui/css/layui.css?t=1534970980648" media="all">
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
    <script src="${base}/js/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${base}/js/ztree/jquery-1.4.4.min.js"></script>
    <script src="${base}/js/jquery.min.js"></script>

    <style type="text/css">
		form{
		  padding:20px;
		}
		.layui-btn-radius{
                 border-radius: 5px;
                }
		</style>
</head>
<body>

<form class="layui-form" action="">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label"><a style="color:red">*</a>&nbsp;房间号</label>
            <div class="layui-input-inline">
                <select lay-verify="required" id="home_id" class=" isNull" lay-search="">
                    <option value=""></option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;姓名</label>
            <div class="layui-input-inline">
                <input name="number" id="username" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;育婴师</label>
            <div class="layui-input-inline">
                <input name="number" id="nursery" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;产康师</label>
            <div class="layui-input-inline">
                <input name="number" id="healthWorker" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;责任护士</label>
            <div class="layui-input-inline">
                <input name="number" id="responsible" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;入住天数</label>
            <div class="layui-input-inline">
                <input name="number" id="days" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;情绪</label>
            <div class="layui-input-inline">
                <input name="number" id="emotion" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;睡眠</label>
            <div class="layui-input-inline">
                <input name="number" id="sleep" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;饮食情况</label>
            <div class="layui-input-inline">
                <input name="number" id="diet" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;血压</label>
            <div class="layui-input-inline">
                <input name="number" id="blood" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;脉搏</label>
            <div class="layui-input-inline">
                <input name="number" id="pulse" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;体温</label>
            <div class="layui-input-inline">
                <input name="number" id="temperature1" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;褥汗</label>
            <div class="layui-input-inline">
                <input name="number" id="sweat" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;伤口情况</label>
            <div class="layui-input-inline">
                <input name="number" id="reply" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;绑腹带</label>
            <div class="layui-input-inline">
                <input name="number" id="strapped" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;乳房有无皲裂</label>
            <div class="layui-input-inline">
                <input name="number" id="chap" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>乳房充盈程度</label>
            <div class="layui-input-inline">
                <input name="number" id="filling" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;恶露量</label>
            <div class="layui-input-inline">
                <input name="number" id="loch" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;恶露颜色</label>
            <div class="layui-input-inline">
                <input name="number" id="color" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;恶露有无异味</label>
            <div class="layui-input-inline">
                <input name="number" id="taste" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" > 备注</label>
            <div class="layui-input-inline">
                <input name="number" id="remarks1"   autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <#--<div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;乳房护理</label>
            <div class="layui-input-inline">
                <input name="number" id="breast" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>-->
       <#-- <div class="layui-inline">
            <label class="layui-form-label" > <a style="color:red">*</a>精神</label>
            <div class="layui-input-inline">
                <input name="number" id="spirit"   autocomplete="off" class="layui-input" type="text">
            </div>
        </div>-->
        <#--<div class="layui-inline">
            <label class="layui-form-label" > <a style="color:red">*</a>自带食物</label>
            <div class="layui-input-inline">
                <input name="number" id="food"   autocomplete="off" class="layui-input" type="text">
            </div>
        </div>-->
        <#--<div class="layui-inline">
            <label class="layui-form-label" > <a style="color:red">*</a>饮食忌口</label>
            <div class="layui-input-inline">
                <input name="number" id="taboo"   autocomplete="off" class="layui-input" type="text">
            </div>
        </div>-->
        <#--<div class="layui-inline">
            <label class="layui-form-label" > <a style="color:red">*</a>开窗通风</label>
            <div class="layui-input-inline">
                <input name="number" id="ventilation"   autocomplete="off" class="layui-input" type="text">
            </div>
        </div>-->
        <#--<div class="layui-inline">
            <label class="layui-form-label" > <a style="color:red">*</a>更换床品</label>
            <div class="layui-input-inline">
                <input name="number" id="bed"   autocomplete="off" class="layui-input" type="text">
            </div>
        </div>-->
       <#-- <div class="layui-inline">
            <label class="layui-form-label" > <a style="color:red">*</a>班次</label>
            <div class="layui-input-inline">
                <input name="number" id="shift"   autocomplete="off" class="layui-input" type="text">
            </div>
        </div>-->
        <#--<div class="layui-inline">
            <label class="layui-form-label" > <a style="color:red">*</a>护理类型</label>
            <div class="layui-input-inline">
                <input name="number" id="nursing"   autocomplete="off" class="layui-input" type="text">
            </div>
        </div>-->
        <#--<div class="layui-inline">
            <label class="layui-form-label" style="width:178px"><a style="color:red">*</a>&nbsp;分娩时间</label>
            <div class="layui-input-inline">
                <input name="date" id="date2" lay-verify="required|date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>-->
        <div class="layui-form-item" style="margin-left:180px">
         <#-- 选择文件:<input type="file" id="file1" />-->
           <#-- <form action="fileUpload" method="post" enctype="multipart/form-data">
                <p>选择文件: <input type="file" name="fileName"/></p>
                 <p><input type="submit" value="提交"/></p>
            </form>-->
<div class="layui-input-block">
                <button class="layui-btn layui-btn-radius" lay-submit lay-filter="formDemo" type="button" onclick="subminMother()" style="background-color: #0092EF;">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-radius">重置</button>
            </div>
        </div>
    </div>
</form>

<script>
layui.use(['form', 'layedit', 'laydate','layer'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
   //日期
  laydate.render({
    elem: '#date'
  });
  laydate.render({
    elem: '#date1'
  });
    laydate.render({
        elem: '#date2'
    });
  //监听提交
 // form.on('submit(formDemo)', function(data){
 //   layer.msg(JSON.stringify(data.field));
 //   return false;
 // });
});




function subminMother(){
    //alert($("#home_id").val());
var jsonDate={};
//房间名字

    jsonDate.roomId= $("#home_id").val();
    //姓名
    jsonDate.username= $("#username").val();
    //伤口情况
    jsonDate.woundrecovery= $("#reply").val();
    //恶露量
    jsonDate.lochia= $("#loch").val();
    //恶露颜色
    jsonDate.color= $("#color").val();
    //有无异味
    jsonDate.taste= $("#taste").val();
    //乳房有无皲裂
    jsonDate.chap= $("#chap").val();
    //乳房充盈程度
    jsonDate.filling= $("#filling").val();
    //体温
    jsonDate.temperature1= $("#temperature1").val();
    //血压
    jsonDate.bloodpressure= $("#blood").val();
    //产康师
    jsonDate.healthWorker= $("#healthWorker").val();
    //饮食情况
    jsonDate.diet= $("#diet").val();
    //育婴师
    //责任护士
    //入住天数
    //脉搏
    //绑腹带
    //褥汗
    //睡眠
    //情绪
    //备注



        jsonDate.lochia= $("#loch").val();
        jsonDate.breast= $("#breast").val();






        jsonDate.nursery= $("#nursery").val();
        jsonDate.responsible= $("#responsible").val();
        jsonDate.days= $("#days").val();
        jsonDate.pulse= $("#pulse").val();
        jsonDate.strapped= $("#strapped").val();
        jsonDate.sweat= $("#sweat").val();
        jsonDate.sleep= $("#sleep").val();
        jsonDate.emotion= $("#emotion").val();
        jsonDate.remarks1= $("#remarks1").val();
        //精神
        jsonDate.spirit= $("#spirit").val();
        //自带食物
        jsonDate.food= $("#food").val();
        //饮食忌口
        jsonDate.taboo= $("#taboo").val();
        //开窗通风
        jsonDate.ventilation= $("#ventilation").val();
        //更换床品
        jsonDate.bed= $("#bed").val();
        //班次
        jsonDate.shift= $("#shift").val();
        //护理类型
        jsonDate.nursing= $("#nursing").val();
        //分娩时间
        jsonDate.deliverTime= $("#date2").val();
         if(!isNull()){
               return;
               }
             $.ajax({
                 type : "POST", //提交方
                 url : "${base}/motherNursing/addmother",//路径
                 data :{"param":JSON.stringify(jsonDate)},
                 success : function(data) {//返回数据根据结果进行相应的处理
                 layer.msg(data);
                                //使用ajax实现上传文件
                              /* var MultipartFile = new FormData();
                               MultipartFile.append("file",document.getElementById("file1").files[0]);
                               MultipartFile.append("RelactionId",id);
                               $.ajax({
                                   async: false,
                                   cache: false,
                                   url: "${base}/motherNursing/uploadFile",
                                   type: "POST",
                                   data: MultipartFile,

                                   /!**
                                    *必须false才会自动加上正确的Content-Type
                                    *!/
                                   contentType: false,
                                   /!**
                                    * 必须false才会避开jQuery对 formdata 的默认处理
                                    * XMLHttpRequest会对 formdata 进行正确的处理
                                    *!/
                                   processData: false,
                                   success: function (data) {
                                       if (flag != 1) {
                                           alert(data);

                                       }
                                   },
                                   error: function () {
                                       alert("上传失败！");
                                   }
                               });*/
                 setTimeout(function(){
                 var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                 parent.layer.close(index); //再执行关闭
                 },200)
                     jsonDate.username= $("#username").val("");
                     jsonDate.woundrecovery= $("#reply").val("");
                     jsonDate.lochia= $("#loch").val("");
                     jsonDate.breast= $("#breast").val("");
                     jsonDate.chap= $("#chap").val("");
                     jsonDate.temperature1= $("#temperature1").val("");
                     jsonDate.bloodpressure= $("#blood").val("");
                     jsonDate.roomId= $("#home_id").val("");
                     jsonDate.color= $("#color").val("");
                     jsonDate.taste= $("#taste").val("");
                     jsonDate.filling= $("#filling").val("");
                     jsonDate.nursery= $("#nursery").val("");
                     jsonDate.responsible= $("#responsible").val("");
                     jsonDate.days= $("#days").val("");
                     jsonDate.pulse= $("#pulse").val("");
                     jsonDate.strapped= $("#strapped").val("");
                     jsonDate.sweat= $("#sweat").val("");
                     jsonDate.sleep= $("#sleep").val("");
                     jsonDate.emotion= $("#emotion").val("");
                     jsonDate.remarks1= $("#remarks1").val("");
                     //产康师
                     jsonDate.healthWorker= $("#healthWorker").val("");
                     //饮食情况
                     jsonDate.diet= $("#diet").val("");
                     //精神
                     jsonDate.spirit= $("#spirit").val("");
                     //自带食物
                     jsonDate.food= $("#food").val("");
                     //饮食忌口
                     jsonDate.taboo= $("#taboo").val("");
                     //开窗通风
                     jsonDate.ventilation= $("#ventilation").val("");
                     //更换床品
                     jsonDate.bed= $("#bed").val("");
                     //班次
                     jsonDate.shift= $("#shift").val("");
                     //护理类型
                     jsonDate.nursing= $("#nursing").val("");
                     //分娩时间
                     jsonDate.deliverTime= $("#date2").val("");
                     var table = parent.layui.table;
                     //表刷新方法
                     table.reload('testReload', {
                         url: '${base}/motherNursing/selectMoterNursing'
                         ,where: {} //设定异步数据接口的额外参数
                     });
                 }
             });
}
/*alert("123")
$("#fileSubmit").click(function() {
    alert(document.getElementById("upLoad"))
    var formData = new FormData();
    formData.append("file", document.getElementById("upLoad").files[0]);
    alert("456")
    $.ajax({
        cache: true,
        type: "POST",
        url: '${base}/motherNursing/upload',
        data: formData,
        processData: false,
        //禁止jquery对DAta数据的处理,默认会处理
        contentType: false,//禁止设置请求类型
        async: false,
        error: function (request) {
            alert("上传失败");
        },
        success: function (data) {
            if (data == 0) {
                alert("上传成功");


            }
        }
    });
});*/
//获取添加时候的房间id
var bas = "${base}"
//home:变量  = zhang.js里边封装的名称(路径,"字典表里边的code")
var home_data = getDataByDicCode(bas,"home")
for(var i=0;i<home_data.length;i++){
$("#home_id").append(
    ' <option value="'+home_data[i].id+'">'+home_data[i].name+'</option>'
)

}
</script>
</body>
</html>
